VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "ApiColour"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Option Explicit

' ##MODULE_DESCRIPTION This class is used to split convert colours between the _
(Red,Green,Blue) representation and the windows COLORREF representation.


'\\ --[ApiColour]--------------------------------------------------
'\\ Utility class for making RGBQUADS from their respective colour
'\\ components
'\\ ---------------------------------------------------------------
'\\ (c) 2001 Merrion Computing Ltd

Private mColourRef As Long


Public Property Let Blue(ByVal newval As Byte)

With APIDispenser
    mColourRef = .MakeLong(.MakeInt(Me.Red, Me.Green), .MakeInt(newval, 0))
End With

End Property

Friend Property Let ColourRef(ByVal newref As Long)

    mColourRef = newref
    
End Property

Friend Property Get ColourRef() As Long

    ColourRef = mColourRef
    
End Property


Public Property Get Description() As String

    Dim sdesc As String
    
    sdesc = "COLOUR:Red=" & Me.Red & ",Green=" & Me.Green & ",Blue=" & Me.Blue
    
    Description = sdesc
    
End Property

Public Property Let Green(ByVal newval As Byte)

With APIDispenser
    mColourRef = .MakeLong(.MakeInt(Me.Red, newval), .MakeInt(Me.Blue, 0))
End With
    
End Property


Public Property Let Red(ByVal newval As Byte)

With APIDispenser
    mColourRef = .MakeLong(.MakeInt(newval, Me.Green), .MakeInt(Me.Blue, 0))
End With

End Property


Public Property Get Red() As Byte

    Red = APIDispenser.LoByte(APIDispenser.LoWord(mColourRef))
    
End Property

Public Property Get Green() As Byte

    Green = APIDispenser.HiByte(APIDispenser.LoWord(mColourRef))
    
End Property

Public Property Get Blue() As Byte

    Blue = APIDispenser.LoByte(APIDispenser.HiWord(mColourRef))
    
End Property


